/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.thienloc.omap.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author GiangLT
 */
@Entity
@Table(name = "BO_SO_TRUNG_THUONG", catalog = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "BoSoTrungThuong.findAll", query = "SELECT b FROM BoSoTrungThuong b"),
    @NamedQuery(name = "BoSoTrungThuong.findByMaTinh", query = "SELECT b FROM BoSoTrungThuong b WHERE b.boSoTrungThuongPK.maTinh = :maTinh ORDER BY b.boSoTrungThuongPK.ngayQuay DESC"),
    @NamedQuery(name = "BoSoTrungThuong.findByNgayQuay", query = "SELECT b FROM BoSoTrungThuong b WHERE b.boSoTrungThuongPK.ngayQuay = :ngayQuay"),
    @NamedQuery(name = "BoSoTrungThuong.findByBoSo", query = "SELECT b FROM BoSoTrungThuong b WHERE b.boSoTrungThuongPK.boSo = :boSo")})
public class BoSoTrungThuong implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected BoSoTrungThuongPK boSoTrungThuongPK;

    public BoSoTrungThuong() {
    }

    public BoSoTrungThuong(BoSoTrungThuongPK boSoTrungThuongPK) {
        this.boSoTrungThuongPK = boSoTrungThuongPK;
    }

    public BoSoTrungThuong(String maTinh, Date ngayQuay, String boSo) {
        this.boSoTrungThuongPK = new BoSoTrungThuongPK(maTinh, ngayQuay, boSo);
    }

    public BoSoTrungThuongPK getBoSoTrungThuongPK() {
        return boSoTrungThuongPK;
    }

    public void setBoSoTrungThuongPK(BoSoTrungThuongPK boSoTrungThuongPK) {
        this.boSoTrungThuongPK = boSoTrungThuongPK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (boSoTrungThuongPK != null ? boSoTrungThuongPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BoSoTrungThuong)) {
            return false;
        }
        BoSoTrungThuong other = (BoSoTrungThuong) object;
        if ((this.boSoTrungThuongPK == null && other.boSoTrungThuongPK != null) || (this.boSoTrungThuongPK != null && !this.boSoTrungThuongPK.equals(other.boSoTrungThuongPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.thienloc.omap.entity.BoSoTrungThuong[ boSoTrungThuongPK=" + boSoTrungThuongPK + " ]";
    }
}
